package springdb.springdb.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springdb.springdb.bean.Department;
import springdb.springdb.mapper.DepartmentMapper;

import java.util.Map;

/**
 * @Auther: luzhanshi
 * @Date: 2021/3/6 - 03 - 06 - 6:07 
 * @Description: springdb.springdb.controller
 * @version: 1.0
 */
@RestController
public class DeptController {
    @Autowired
    DepartmentMapper departmentMapper;

    @GetMapping("/dept/{id}")
    public Department getDeptById(@PathVariable(name = "id") int id){
        return departmentMapper.getDeptById(id);
    }

    @GetMapping("/dept")
    public Department insertDept(Department department){
        departmentMapper.insertDept(department);
        return department;

    }
}
